#include "stm32f10x.h"
#include "system_intr.h"

static int32_t intx_disable_nested = 0;

void INTX_DISABLE(void)
{          
    if(0 >= intx_disable_nested)
    {
        intx_disable_nested = 0;
        __ASM volatile("cpsid i");                
    }
    
    intx_disable_nested ++;
}

void INTX_ENABLE(void)
{
    intx_disable_nested --;
    
    if(0 >= intx_disable_nested)
    {
        intx_disable_nested = 0;
        __ASM volatile("cpsie i");              
    }      
}
